<extend name="Extends/base"/>
<block name="title">编辑收徒分成配置</block>
<block name="css">
</block>
<block name="body_style">class="bgc-f2f4f6"</block>
<block name="body">
    <div class="bgc-f3f3f3 ptb5 plr20 c-border-tb clearfix">
        <b class="c-f16" style="line-height: 40px">编辑收徒分成配置</b>
        <a href="javascript:;" class="jump-href fr c-btn c-btn-green c-btn-rounded ml10">刷新</a>
    </div>
    <div class="pt30 plr20">
        <div class="form-layout form-horizontal-wider">
            <em class="pop-close"></em>
            <form id='myForm'>
                <div class="control-group mb10">
                    <label class="control-label"><sub class="control-sub"></sub> 分成上限：</label>
                    <div class="control-form">
                        <input type="number" name="upper" value="{$info['upper']/100}" placeholder="分成上限"
                               class="input-text input-text-w90">（元）
                    </div>
                </div>

                <div class="control-group mb10">
                    <label class="control-label"><sub class="control-sub"></sub> 分成百分比：</label>
                    <div class="control-form">
                        <input type="number" name="per"
                               placeholder="百分比" value="{$info.per}"
                               class="input-text input-text-w90">（%）
                    </div>
                </div>
            </form>
            <div class="control-group mb10">
                <label class="control-label"></label>
                <div class="control-form">
                    <a class="edit-btn c-btn c-btn-blue">提交</a>
                </div>
            </div>
        </div>

    </div>
</block>
<block name="js">
    <script type="text/javascript" src="__CST__/js/api.recomm.js?v={:C('JS_CSS_VERSION')}"></script>

    <script type="text/javascript">
        var id = "{$info.id}";
        $('.edit-btn').on('click', function () {
            var data = getSeachData();
            doEditConf(id, data, function (res) {
                if (res.Code != 10000) {
                    $.toast(res.Message);
                    return false;
                }

                location.reload();
            });
        });

        /**
         * 获取搜索的数据
         * @returns {{}}
         */
        function getSeachData() {
            var fromData = $('#myForm').serializeArray();
            var data = {};
            $.each(fromData, function () {
                var name = this.name;
                var value = $.trim(this.value);
                if (value) {
                    data[name] = value;
                }
            });
            return data;
        }
    </script>
</block>